<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Stoarge技术</title>
    <script type="text/javascript">
        function add() {
            localStorage.setItem("name","zs")
        }
        function del() {
            localStorage.removeItem("name");
            // localStorage.clear()
        }
        function update() {
            localStorage.setItem("name","zs-edit");
        }
        function get() {
            alert(localStorage.getItem("name"));
        }
    </script>
</head>
<body>

  <!--其实我们要在浏览器存储一个数据，除了cookie,h5还提供了，两个js对象sessionStorage,localStorage-->
<!--可以完成存储。-->
  <!--sessionStorage:当前浏览器当前窗口有效，从开启到关闭的时间有效，没啥卵用-->
  <!--localStorage：除非你删除，否则一直有。是否可跨浏览器，是否可跨窗口-->

    <button type="button" onclick="add()">add</button>
    <button type="button" onclick="del()">del</button>
    <button type="button" onclick="update()" >update</button>
    <button type="button" onclick="get()">get</button>
</body>
</html>